import request from './request'

export function getContacts(data: { dealId: number, companyId: number }): Promise<any> {
    return request.get('/api/v1/crm/product-deal-contact', data)
}

// 整个客户联系人列表
export function getCustomerContacts(data: { searchText: string, pageNum?: number | string, pageSize?: number }): Promise<any> {
    return request.get('/api/v1/crm/custom-contact/get-potential-clients', data)
}

// 添加客户联系人列表
export function addContacts(data: {
    cstContactIds: string[],
    dealId: string
}): Promise<any> {
    return request.post('/api/v1/crm/product-deal-contact', data)
}

// 删除客户联系人
export function deleteContacts(data: {
    id: string
}): Promise<any> {
    return request.put('/api/v1/crm/custom-contact/delete-contacts', data)
}

// 删除相关联系人
export function deleteRelevantContacts(data: {
    id: string
}): Promise<any> {
    return request.put('/api/v1/crm/product-deal-contact', data)
}

// 新增联系人
export function newContacts(data: any) {
    return request.post('/api/v1/crm/custom-contact/add-contacts', data)
}

// 查询企业名称
export function getEnterpriseName(data: any): Promise<any> {
    return request.get('/api/v1/crm/custom-contact/searchEnterpriseInfo', data)
}

// 信息回显 /api/v1/crm/custom-contact/get-customer-info
export function getEchoContacts(data: { cstContactId: string }): Promise<any> {
    return request.get('/api/v1/crm/custom-contact/get-customer-info', data)
}

// 编辑信息 /api/v1/crm/custom-contact/update-contacts
export function getEditContacts(data: any): Promise<any> {
    return request.put('/api/v1/crm/custom-contact/update-contacts', data)
}

// 检查客户是否已开过户
export function checkcompanyisopenapi(data: any) {
    return request.get('/api/v1/crm/custom-contact/check-company-is-open', data)
}


// 查询联系人详细信息
export function getpotentialclientsapi(id: any) {
    return request.get('/api/v1/crm/custom-contact/get-potential-clients/' + id)
}

// 删除联系人
export function deldeletecontactsapi(data: any) {
    return request.put('/api/v1/crm/custom-contact/delete-contacts', data)
}

// 修改联系人
export function updatecontactapi(data: any) {
    return request.put('/api/v1/crm/custom-contact/update-contacts', data)
}

// 总业绩排行榜
export function getqueryrankinglistallapi(data: any) {
    return request.get('/api/v1/crm/sign-contract-record/query-ranking-list-all', data)
}

// 新增总业绩额增长排行榜
export function getqueryriserankinglistallapi(data: any) {
    return request.get('/api/v1/crm/sign-contract-record/query-rise-ranking-list-all', data)
}

// 长期保进步榜排行榜
export function getqueryrankinglistinsurapi(data: any) {
    return request.get('/api/v1/crm/sign-contract-record/query-ranking-list-insur', data)
}

// 签单详情新建联系人
export function addproductdealcontactapi(data: any) {
    return request.post('/api/v1/crm/product-deal-contact', data)
}

export function getcompanylist(params: any) {
    return request.get('/api/v1/crm/custom-contact/get-company-info', params)
}

// 新人排行榜
export function getquerynewpeoplerankingapi(data: any) {
    return request.get('/api/v1/crm/sign-contract-record/query-new-people-ranking', data)
}
